package com.zhao.dome01.handler;

import com.zhao.dome01.commen.Result;
import com.zhao.dome01.exception.BaseException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//全局异常处理
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler{

    //拦截业务异常
    @ExceptionHandler
    public Result<Exception> BusinessExceptionHandler(BaseException baseException){
        log.info("异常信息:{}",baseException.getMessage());
        return Result.error(baseException.getMessage());
    }

    //TODO  SQL异常未处理
}
